#ifndef __CCUSTOM_HYPERLINK_CONTROL_H__
#define __CCUSTOM_HYPERLINK_CONTROL_H__

#include <gdiplus.h>
using namespace Gdiplus;

class CCustomHyperLink : public CButton
{
	DECLARE_DYNAMIC(CCustomHyperLink)

//*************************************************************************************************//Class Function
public:
	CCustomHyperLink(void);
	~CCustomHyperLink(void);

	void Initialize(HWND hPParentWnd, HWND hParentWnd, HDC hBgDC, HDC hDrawDC, int nParentx = 0, int nParenty = 0);

	//String or Font Setting
	void SetWindowTextW(LPCTSTR lpszString);
	void SetFontSize(int nSize);
	void SetFontStyle(UINT nStyle);
	void SetFontColor(int nR, int nG, int nB);
	void SetFontFamily(CString strFontFamilyName);

	//Set HyperLink
	void SetURL(const CString &strURL);
	void SetProcess(const CString &strProcess, const CString &strCmd, int nshow = SW_HIDE);

	//UI Drawing
	void DrawUI();
	BOOL ShowWindow(int nCmdShow);
private:
	void CreateFont();

//*************************************************************************************************//Class Parameters
public:

private:
	//String and Font Parameter
	CString m_strText;
	int m_nFontSize, m_nFontStyle;
	Gdiplus::Unit m_enFontUnit;
	Gdiplus::StringFormat* m_strTextFormat;
	Gdiplus::FontFamily* m_pFontFamily;
	Gdiplus::SolidBrush* m_pFontBrush;
	Gdiplus::Font* m_pFont;

	//UI Rect Parameter
	CRect m_rtRect, m_rtPRect, m_rtPPRect;

	//andle Parameter
	HDC m_hBgDC, m_hDrawDC;
	HWND m_hPParentWnd, m_hParentWnd;

	int m_nShow;
	HCURSOR  m_hLinkCursor;
	bool m_bRunProcess, m_bRunURL;
	CString m_strURL, m_strProcess, m_strCmd;

//*************************************************************************************************//Class Message
public:
	virtual void PreSubclassWindow();
	virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
	DECLARE_MESSAGE_MAP()
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnBnClicked();
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
};
#endif

